home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / serien / purity / nr.45 / katalog / localetest.p < prev    next >
Text File  |  1995-03-07  |  1KB  |  58 lines

  1. Program LocaleDemo;
  2.  
  3. { 1994/95 by Andreas Tetzl & Røgersøft }
  4. { Public Domain }
  5. { Für OS2.1+ }
  6.  
  7. {$Include 'locale.lib','Exec.Lib'}
  8.  
  9.  
  10. TYPE deftyp=ARRAY[0..3] OF STRING;
  11. VAR Loc : p_Locale;
  12.     Cat : p_Catalog;
  13.     StrNum : Integer;
  14.     Str : String;
  15.     VAR Defstrings:deftyp;
  16.  
  17. Procedure CleanExit(Why : String; RC : Integer);
  18. Begin
  19.  If cat<>NIL then CloseCatalog(cat);
  20.  If loc<>NIL then CloseLocale(loc);
  21.  If LocaleBase<>NIL then CloseLibrary(LocaleBase);
  22.  If Why<>'' then Writeln(Why);
  23.  delay(10*50); { 10 sekunden zum lesen}
  24.  close(input);
  25.  HALT(RC);
  26. end;
  27.  
  28. Begin
  29.  DefStrings:=deftyp("LocaleDemo V1.1 1994/95 by Andreas Tetzl & Røgersøft",
  30.                     "This program demonstrates the use of the locale.library.",
  31.                     "This is the default text.",
  32.                     "Ten seconds time to read this msg.");
  33.  Reset(input,'CON:0/0/400/200/Catalogtester');
  34.  output:=input;
  35.  { Als erstes die locale.library öffnen. }
  36.  LocaleBase := OpenLibrary("locale.library", 38);
  37.  If LocaleBase=NIL then CleanExit("Benötige OS2.1+",10);
  38.  
  39.  { Zugriff auf die voreingestellte Sprache. }
  40.  { Sollte für dieses Programm Deutsch sein. }
  41.  loc := OpenLocale(NIL);
  42.  If loc=NIL then CleanExit("Keinen Zugriff auf voreingestellte Sprache",10);
  43.  
  44.  cat := OpenCatalogA(loc, "example.catalog", NIL);
  45.  
  46.  For StrNum:=0 to 3 do
  47.   Begin
  48.    Str := DefStrings[StrNum];
  49.    If cat<>NIL then Str := GetCatalogStr(cat, StrNum, "Catalog fehlerhaft.");
  50.    Writeln(Str);
  51.   end;
  52.  
  53.  CleanExit('',0);
  54. end.
  55.  
  56.  
  57.  
  58.